# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html

import scrapy
import re
from scrapy.loader.processors import MapCompose, TakeFirst, Join


class DoubanMovieItem(scrapy.Item):
    # define the fields for your item here like:
    # name = scrapy.Field()
    pass


def del_tag(value):
    dr = re.compile(r'<[^>]+>',re.S)
    dd = dr.sub(' ',value)
    return dd;


def del_n(value):
    return value.replace('\n','')


class MovieItem(scrapy.Item):
    url = scrapy.Field()
    name = scrapy.Field()
    summary = scrapy.Field()
    score = scrapy.Field()


class JobItem(scrapy.Item):
    name = scrapy.Field()
    job_saray =  scrapy.Field()
    exper = scrapy.Field() #工作经验
    educ = scrapy.Field()
    company = scrapy.Field(
        input_processor=MapCompose(del_n),
    )
    companyInfo = scrapy.Field()
    welfare = scrapy.Field()
    address = scrapy.Field(
        input_processor=MapCompose(del_tag),
    )
    responsibility = scrapy.Field(
        input_processor=MapCompose(del_tag),
    )
